
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - FooTable</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/footable/footable.core.css" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>病人咨询</h5>

                            
                        </div>
                        <div class="ibox-content">

                            <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="8">
                                <thead>
                                <tr>

                                    <th data-toggle="true">问题详情</th>
                                    <th>姓名</th>
                                    <!--<th>提交时间</th>-->
                                    <th data-hide="all">年龄</th>
                                    
                                    <th data-hide="all">性别</th>
                                    <th data-hide="all">问题详情</th>
                                    <th data-hide="all">回答</th>
                                    <th>状态/操作</th>
                                </tr>
                                </thead>
                                <tbody id="tbody">
                                	
                                <tr>
                                	<td>脖子疼</td>
                                    <td>曹操</td>
                                    <td>26</td>
                                    <td>女</td>
                                    <td>脖子疼</td>
                                    <td><span class="pie"></span></td>
                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;<a href="doctor-question-re.html">回答</a></td>
                                </tr>
                                <tr>
                                	<td>脑瓜子疼</td>
                                    <td>曹操</td>
                                    <td>26</td>
                                    <td>女</td>
                                    <td>脑瓜子疼</td>
                                    <td><span class="pie">建议砍头</span></td>

                                    <td><a href="#"><i class="fa fa-check text-navy"></i> 已回答</a></td>
                                </tr>
                                
                                </tbody>
                                <tfoot>
                                <tr>
                                    <td colspan="5">
                                        <ul class="pagination pull-right"></ul>
                                    </td>
                                </tr>
                                </tfoot>
                            </table>

                        </div>
                    </div>
                </div>
            </div>
            
        </div>
    <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>
    <script src="js/plugins/footable/footable.all.min.js"></script>

    <!-- 自定义js -->
    <script>
        $(document).ready(function() {
            getQuestion();
            $('.footable').footable();
            $('.footable2').footable();

        });

        function getQuestion(){
            $.ajax({
                async: false,
                type: "post",
                url: "/getQuestion",
                contentType: 'application/json',
                dataType: "text",
                success: function (data) {
                    var result = JSON.parse(data);
                    console.log(result);
                    if (result.SUCCESS) {
                        list = result.RESULT;
                        console.log(list);
                        makeList(list)
                    } else {
                        console.log(result.RESULT);
                    }
                },
                error: function (data) {
                    alert("请求失败");
                }
            });
        }


        function makeList(list) {

            var html = "";
            for (var i = 0; i < list.length; i++) {
                /**
                 * <th data-toggle="true">问题详情</th>
                 <th>姓名</th>
                 <!--<th>提交时间</th>-->
                 <th data-hide="all">年龄</th>

                 <th data-hide="all">性别</th>
                 <th data-hide="all">问题详情</th>
                 <th data-hide="all">回答</th>
                 <th>状态/操作</th>
                 * @type {string}
                 */
                html += " <tr><td>" + list[i].message + "</td>    ";
                html += " <td>" + list[i].userName + "</td>";
                html += " <td>" + list[i].age + "</td>";
                if(list.sex == 1){
                    html += " <td>" + "女" + "</td>";
                }else{
                    html += " <td>" + "男" + "</td>";
                }
                html += " <td>" + list[i].message + "</td>";
                html += " <td>" + list[i].answer + "</td>";
                if(list[i].status == 0){
                    html += " <td><a href='doctor-question-re.html?id="+ list[i].id  +"'>处理</a> </td></tr>";
                }else{
                    html += "<td><a href='#'><i class='fa fa-check text-navy'></i> 已回答</a></td></tr>";
                }

            }
            $('#tbody').html(html);
            console.log(html);
        }





    </script>

</body>

</html>
